/****** Object:  Table [dbo].[ProjectDocument]    Script Date: 10/12/2009 10:03:09 ******/


GO
SET QUOTED_IDENTIFIER ON

GO
--~ Table [dbo].[ProjectDocument] -- PAD_INDEX removed.  It is not supported in this version of SQL Server
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ProjectDocument]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[ProjectDocument](
	[ProjectId] [int] NOT NULL,
	[DocumentId] [int] IDENTITY(1,1) NOT NULL,
	[DocumentType] [smallint] NOT NULL,
	[Title] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
	[Description] [nvarchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
	[Contents] [varbinary](max) NOT NULL,
	[DateUploaded] [date] NOT NULL,
	[SubmittedBy] [nvarchar](10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
 CONSTRAINT [PK_ProjectDocument] PRIMARY KEY CLUSTERED 
(
	[DocumentId] ASC
)WITH (STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF)
)
END

GO
/****** Object:  Table [dbo].[ProjectPhoto]    Script Date: 10/12/2009 10:03:10 ******/


GO
SET QUOTED_IDENTIFIER ON

GO
--~ Table [dbo].[ProjectPhoto] -- PAD_INDEX removed.  It is not supported in this version of SQL Server
--~ Table [dbo].[ProjectPhoto] -- Removed 'ROW GUID COLUMN' because it is not supported in this version of SQL Server.
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ProjectPhoto]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[ProjectPhoto](
	[ProjectId] [int] NOT NULL,
	[PhotoId] [int] IDENTITY(1,1) NOT NULL,
	[PhotoType] [smallint] NOT NULL,
	[Title] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
	[Description] [nvarchar](255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
	[Image] [varbinary](max) NULL,
	[DateUploaded] [date] NOT NULL,
	[SubmittedBy] [nvarchar](10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
	[PhotoGUID] [uniqueidentifier]  NOT NULL,
 CONSTRAINT [PK_ProjectPhoto] PRIMARY KEY CLUSTERED 
(
	[PhotoId] ASC
)WITH (STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF),
 CONSTRAINT [UQ__ProjectP__C736ED60014935CB] UNIQUE NONCLUSTERED 
(
	[PhotoGUID] ASC
)WITH (STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF)
)
END

GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[DF__ProjectPh__Photo__03317E3D]') AND type = 'D')
BEGIN
ALTER TABLE [dbo].[ProjectPhoto] ADD  CONSTRAINT [DF__ProjectPh__Photo__03317E3D]  DEFAULT (newid()) FOR [PhotoGUID]
END


GO
